<?php
include_once("include/config.php");
include_once("include/auth.lib.php");

list($status, $user) = auth_get_status();

if($status == AUTH_LOGGED & auth_get_option("TRANSICTION METHOD") == AUTH_USE_LINK){
	$link = "?uid=".$_GET['uid'];
}else	$link = '';
?>
<html>
	<head>
		<title>Homeee Page</title>
	</head>
	<body>
	<div align="center">
		<table cellspacing="2">
			<tr>
				<td><a href="home.php<?=$link?>">Home Page</a></td>
				<td><a href="pagina1.html<?=$link?>">Prima Pagina (pubblica)</a></td>
				<td><a href="pagina2.php<?=$link?>">Seconda Pagina (privata)</a></td>
				<td><a href="pagina3.php<?=$link?>">Terza Pagina (privata)</a></td>
				<td><a href="pagina4.php<?=$link?>">Quarta Pagina (privata)</a></td>
			</tr>
		</table>
		<?php
		switch($status){
			case AUTH_LOGGED:
			?>
		<b>Sei loggato con il nome di <?=$user["name"];?> <a href="logout.php<?=$link?>">Logout</a></b>
			<?php
			break;
			case AUTH_NOT_LOGGED:
			?>
		<form action="login.php<?=$link?>" method="post">
			<table cellspacing="2">
				<tr>
					<td>Nome Utente:</td>
					<td><input type="text" name="uname"></td>
				</tr>
				<tr>
					<td>Password:</td>
					<td><input type="password" name="passw"></td>
				</tr>
				<tr>
					<td colspan="2"><input type="submit" name="action" value="login"></td>
				</tr>
			</table>
		</form>
		<?php
			break;
		}
		?>
	</div>
	</body>
</html>
